{% extends 'base.html' %}
{% load static %}
{% block content %}
    <div class="container" id="alertTest">
        <div class="alert alert-warning alert-dismissible fade show hidden">
            <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                <span aria-hidden="true">&times;</span>
            </button>
            <strong id="msg1">{{ msg }}</strong>
        </div>
    </div>
    <script type="text/javascript">
        var flag = false;

        function check() {
            var ids = document.getElementById("exampleCheck1");
            if (ids.checked) {
                flag = true;
            }
            if (!flag) {
                alert("请同意用户协议！");
                return false;
            }
        }

        var msg = document.getElementById("msg1").innerText;
        if (msg === "") {
            document.getElementById("alertTest").style.display = 'none';
        } else {
            document.getElementById('alertTest').style.display = 'inline';
        }

    </script>

    <div class="container">
        <hr>
        <div class="row">
            <div class="col col-sm-1"></div>
            <div class="col col-sm-4">
                <img src="https://www.ecut.edu.cn/_upload/article/images/d0/3a/313f46bb4cae82597dca4d3e5b49/246d5135-d920-4ba0-9ec5-150a11a9da52.jpg "
                     width="370px" alt="东华理工大学">
            </div>
            <div class="col col-sm-1"></div>
            <div class="col-sm-5">
                <form action="{% url 'grade' %}" onsubmit="return check()" method="post">
                    <div class="form-group">
                        <label for="exampleInputUsername1">学号</label>
                        <input type="text" class="form-control" name="username" id="exampleInputUsername1"
                               aria-describedby="userHelp">
                        <small id="userHelp" class="form-text text-muted">您的账号密码都保存在本地，并不保存在服务器中，请妥善保管。</small>
                    </div>
                    <div class="form-group">
                        <label for="exampleInputPassword1">密码</label>
                        <input type="password" class="form-control" name="password" id="exampleInputPassword1">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputnumid">查询方式</label>
                        <select class="form-control" name="numid" id="exampleInputnumid">
                            <option>新系统</option>
                            <option>旧系统</option>
                        </select>
                    </div>
                    <input type="hidden" name="inputYear" id="exampleInputYear1" value="2020">
                    <input type="hidden" name="inputSemester" id="exampleInputSemester" value="">
                    <div class="form-group form-check">
                        <input type="checkbox" class="form-check-input" id="exampleCheck1">
                        <label class="form-check-label" for="exampleCheck1">本软件仅供学习交流，如作他用所承受的法律责任一概与作者无关</label>
                    </div>
                    <button type="submit" class="btn btn-success" style="float: right;width: 80px">查询</button>
                </form>
            </div>
        </div>
        <hr>
    </div>
{% endblock %}
